/* GUI CONVERTED from woworla.p (converter v1.76) Sun Nov 25 22:43:35 2001 */
/* woworla.p - PRINT / RELEASE WORK ORDERS 1st subroutine                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.9 $                                                        */
/* REVISION: 1.0       LAST EDIT: 06/30/86      MODIFIED BY: EMB              */
/* REVISION: 1.0       LAST EDIT: 01/29/87      MODIFIED BY: EMB *A19*        */
/* REVISION: 2.0       LAST EDIT: 07/24/87      MODIFIED BY: EMB *A75*        */
/* REVISION: 2.0       LAST EDIT: 11/18/87      MODIFIED BY: EMB *A75*        */
/* REVISION: 2.0       LAST EDIT: 12/04/87      MODIFIED BY: EMB *A75*        */
/* REVISION: 4.0       LAST EDIT: 01/06/88      MODIFIED BY: RL  *128*        */
/* REVISION: 4.0       LAST EDIT: 06/13/88      MODIFIED BY: EMB *A288*       */
/* REVISION: 4.0       LAST EDIT: 07/22/88      MODIFIED BY: EMB *A347*       */
/* REVISION: 4.0       LAST EDIT: 04/14/89      MODIFIED BY: EMB **           */
/* REVISION: 5.0       LAST EDIT: 06/23/89      MODIFIED BY: MLB *B159*       */
/* REVISION: 7.0       LAST EDIT: 09/14/92      MODIFIED BY: emb *F892*       */
/* REVISION: 7.3       LAST EDIT: 12/31/92      MODIFIED BY: pma *G382*       */
/* REVISION: 7.3       LAST EDIT: 02/09/93      MODIFIED BY: emb *G656*       */
/* REVISION: 7.3       LAST EDIT: 06/21/93      MODIFIED BY: qzl *GC35*       */
/* REVISION: 7.3       LAST EDIT: 09/23/93      MODIFIED BY: pxd *GF80*       */
/* REVISION: 7.2       LAST EDIT: 03/18/94      MODIFIED BY: ais *FM19*       */
/* Oracle changes (share-locks)   09/13/94      MODIFIED BY: rwl *GM56*       */
/* REVISION: 8.6       LAST EDIT: 05/20/98      BY: *K1Q4* Alfred Tan         */
/* REVISION: 9.1       LAST EDIT: 08/12/00      BY: *N0KC* Mark Brown         */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.7       BY: Manisha Sawant       DATE: 11/30/00 ECO: *P008*    */
/* Revision: 1.8    BY: Niranjan R.  DATE: 07/13/01 ECO: *P00L*   */
/* $Revision: 1.9 $   BY: Kirti Desai  DATE: 11/23/01 ECO: *M1QS*   */
/* $Revision: eB2 SP3 $         BY: Ricky Ho         DATE: 10/20/03  ECO: *HK-S-019*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/*V8:ConvertMode=Maintenance                                                  */

/* DECLARE COMMON VARIABLES          */
{mfdeclre.i}

define shared workfile pkdet no-undo
   field pkpart like pk_part
   field pkop as integer
   field pkstart like pk_start
   field pkend like pk_end
   field pkqty like pk_qty
   field pkltoff like ps_lt_off.

define shared variable comp like ps_comp.
define shared variable site like ptp_site no-undo.
define shared variable eff_date as date.
define shared variable phantom like mfc_logical.

define variable qty as decimal initial 1 no-undo.
define variable level as integer initial 1 no-undo.

define variable maxlevel as integer initial 99 no-undo.
define variable record as integer extent 100 no-undo.
define variable save_qty as decimal extent 100 no-undo.
define variable i as integer no-undo.

define variable effstart as date no-undo.
define variable effend as date no-undo.
define variable eff_start as date extent 100 no-undo.
define variable eff_end as date extent 100 no-undo.
define variable l_mfguser as character format "x(18)" no-undo.

/*DEFINE VARIABLES FOR BILL OF MATERIAL EXPLOSION         */
{gpxpld01.i "shared"}

{mfdel.i pkdet}

hide message no-pause.

l_mfguser = mfguser + "         ".

/*@@@@@@@@{gpxpldps.i*/
/*@@@@@@@@*/ {xxgpxpldps.i
   &date=eff_date
   &site=site
   &comp=comp
   &group=null_char
   &process=null_char
   &op=?
   &phantom=phantom}

for each pk_det
   where pk_user >= mfguser
   and   pk_user <= l_mfguser
   exclusive-lock:

   find first pkwkfl where pkrecid = recid(pk_det).
   create pkdet.
   assign
      pkpart = pk_part
      pkstart = pk_start
      pkop = integer(pk_reference)
      pkend = pk_end
      pkqty = pk_qty
      pkltoff = ltoff.
   if recid(pkdet) = -1 then .
   delete pk_det.
   delete pkwkfl.

end.
